<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>闲言轻博客模板 v1.0 页面目录</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="keywords" content="fly,layui,前端社区">
  <meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区，致力于为web开发提供强劲动力">
    <link rel="stylesheet" href="simplemde.css">
	<link href="http://cdn.nbclass.com/statics/simplemde/github-markdown.min.css" rel="stylesheet">
	<link href="http://cdn.nbclass.com/statics/highlight/highlight.min.css" rel="stylesheet">
	<script src="http://cdn.nbclass.com/statics/highlight/highlight.min.js"></script>  
	</head>
<body>
	<div class="form-group">
        <textarea name="field" id="fieldTest" cols="30" rows="10"></textarea>
    </div>
	<button onclick="test()">提交</button>
	
	<div id="edit"></div>
	<div class="markdown-body">
		<pre><code>&lt;h1&gt;123&lt;/h1&gt;
</code></pre>
	</div>
		
<script src="simplemde.js"></script>

<script>

	var simplemde = new SimpleMDE({
		    element: document.getElementById("fieldTest"),
			status: false,
			toolbar: [
            "bold", "italic", "strikethrough", "heading", "code", "quote", "unordered-list",
            "ordered-list", "clean-block", "link", "image", "table", "horizontal-rule", "preview", "side-by-side", "fullscreen", "guide",
            {
                name: "uploadImage",//自定义按钮
                action: function customFunction(editor) {
                    console.log(editor);
                },
                className: "fa fa-star",
                title: "Upload Image"
            }
        ]
    });
	
	function test(){
		var testPlain = simplemde.value(), 
		testMarkdown = simplemde.markdown(testPlain);
		console.log(testMarkdown)
	}
	

	
	
</script>
</body>
</html>